package com.scw.service.serviceImp;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;

import com.scw.model.Advertsing;
import com.scw.model.SysUser;
import com.scw.service.AdvertsingService;
@Component("advertsingService")
public class AdvertsingServiceImp implements AdvertsingService {
	@Autowired
	private HibernateTemplate hibernateTemplate;
	
	public Advertsing add(Advertsing advertsing) {
		advertsing=(Advertsing) getHibernateTemplate().save(advertsing);
		return advertsing;
	}

	public void del(Advertsing advertsing) {
		getHibernateTemplate().delete(advertsing);

	}

	public Advertsing get(Long id) {
		Advertsing advertsing=
		(Advertsing) getHibernateTemplate().get(Advertsing.class,id);
		return advertsing;
	}

	public List<Advertsing> getall(Advertsing advertsing) {
		List<Advertsing> list =new ArrayList<Advertsing>();
		list=getHibernateTemplate().findByExample(advertsing);
		return list;
	}

	public Advertsing update(Advertsing advertsing) {
		getHibernateTemplate().update(advertsing);
		return advertsing;
	}

	public HibernateTemplate getHibernateTemplate() {
		return hibernateTemplate;
	}

	public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
		this.hibernateTemplate = hibernateTemplate;
	}

}
